(function(){
	var api = 'http://h6.duchengjiu.top/shop/';
	var oTable = document.getElementById('table');
	var oAllP = document.getElementById('allPrice');
	
	
	$.get(api + 'api_cart.php',{'token':localStorage.getItem('token')}, function(result){
		var obj=result.data;
		var trStr='';
			for(var i = 0;i < obj.length; i++){
				var xiaoji = obj[i].goods_number * obj[i].goods_price + '.00';
				trStr += `
					<tr>
						<td>
							<img src="${obj[i].goods_thumb}"/>
						</td>
						<td style='width:620px'>${obj[i].goods_name}</td>
						<td style='width:100px'>
							${obj[i].goods_number}
						</td>
						<td name = "heihei" style='width:200px'>￥${xiaoji}</td>
					</tr>
				`;
				};
			oTable.innerHTML = trStr;
			var allPirce = 0;
			var aHeihei = document.querySelectorAll('[name = "heihei"]');
			for(x = 0; x < aHeihei.length; x++){
				var aa = aHeihei[x].innerHTML;
				var oXiaojiPrice=aa.replace(/[^0-9^.]/g,"");
				allPirce += parseInt(oXiaojiPrice);
				
			};
			oAllP.innerHTML = '￥' + allPirce + '.00';
			
	})

})();

	

